<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<%@ include file="/common/import.jsp" %>
<script>
  var thsTitle = "竞买人管理";
  var objName="apply";
  var currentObjId = "";
</script>
<script type="text/javascript" src="${ctx}/js/zbxupload.js"></script> 
<title>竞价统计-${sysName}</title>
</head>
<body class="home-template">
<!-- 正文开始 -->
<div class="searchForm"><form id="applyList_form">
		<input type="hidden" name="page"  value="1">
		<input type="hidden" name="rows"  value="10">
		竞买人登录名：<input type="text" name="userName"  value="" /> 
		<!--中文乱码查询不出来
		 标的/活动名称：<input type="text" name="objName"  value="" />
		 --> 
		标的状态：<select style="width:120px;" id="applyItemStatus" >
			 <option value="underway">进行中</option>
			 <option value="finish">已结束</option>
			</select>
		<a class="easyui-linkbutton"  iconCls="icon-search" onclick="applyListSearch();">查询</a>
		<a class="easyui-linkbutton"  onclick="clearFormById('applyList_form');">清空</a>
	</form></div>
	<table id="applyList_table" class="info" cellspacing="1" cellpadding="0">
		<tr class='active' id="title2" >
			<th width='15%'>竞买人登录名</th>
			<th width='15%'>姓名</th>
			<th width='30%'>标的/活动名称</th>
			<th width='10%'>电话</th>	
			<th width='8%'>报名方式</th>
			<th width='8%'>状态</th>
			<th width='10%' class='th_center'>操作</th>
		</tr>
	</table>
	<div id="applyList_page" class="page"></div>
	<script type="text/template" id="applyList_html">
	<? for ( var i = 0; i < rows.length; i++) {?>
		<tr>
			<td><?=rows[i].userName?></td>
			<td><?=rows[i].realName?></td>
			<td title=<?=rows[i].objName?>><?=strUtil.subStr(rows[i].objName,25)?></td>
			<td><?=rows[i].phone?></td>
			<td><?=applyWayText(rows[i].applyWay)?></td>
			<td><?=applayStatusText(rows[i].status)?></td>
			<td>
				<?if(objName=="apply"){?>
				 <a class="mybutton"  onclick="openUpdateApply('${bidSession.bailCtrl}','<?=rows[i].applyId?>','<?=rows[i].realName?>','<?=rows[i].phone?>','<?=rows[i].email?>','<?=rows[i].status?>','<?=rows[i].allowBuyNum?>','<?=rows[i].factBail?>');">修改</a>&nbsp;
				||&nbsp;<a class="mybutton"  onclick="viewCache('<?=rows[i].userName?>','<?=rows[i].itemId?>','<?=rows[i].sessionId?>');">查缓存</a>
               <?}else{?>	
                 	 已结束!
			   <?}?>			
			</td>
		</tr>
	<?}?>  		
	</script><!-- 正文结束 -->
	<%@ include file="/common/top.jsp" %>
<!-- 比较窗口 -->
<div id="new-window" class="easyui-dialog" title="new" modal="true" style="width:900px;height:530px" closed="true">
<iframe id="new-window-url" style="border:0px;width:850px;height:460px;">
</iframe>
</div>
<!-- 修改竞买人窗口 -->
<div class="easyui-dialog" id="updateApply_window" title="修改竞买人信息" closed="true" modal="true" style="width:800px;height:400px;">
<form id="updateApplyForm">
<table class="info" cellspacing="1" cellpadding="0">
	<input type="hidden" name="applyId" id="applyId" value="">
	<tr>
		<th>姓名：</th>
		<td><input type="text" name="realName" id="realName"  size="30" maxlength="50" class="easyui-validatebox validatebox-text" required="true"/> </td>
	</tr>
	<tr>
		<th>电话：</th>
		<td><input type="text" name="phone" id="phone" size="30" maxlength="30" class="easyui-validatebox validatebox-text" required="true"/> </td>
	</tr>
	<tr>
		<th>邮箱：</th>
		<td><input type="text" name="email" id="email" maxlength="30" size="30" class="easyui-validatebox validatebox-text" required="true"/> </td>
	</tr>
	
	<!-- <tr>
		<th>状态：</th>
		<td>
			<input type="radio" name="status" value="0" checked="checked"/>未激活 &nbsp; &nbsp; &nbsp;
			<input type="radio" name="status" value="1"/>已激活
		 </td>
	</tr> -->
	<tr>
		<td colspan="2" style="text-align:center;">
			<a class="easyui-linkbutton" id="updateApplyButton" iconCls="icon-add" onclick="saveUpdateApply();">保存修改</a>
			如果修改竞价标的数量、实交保证金、激活等，请到专厅、专场或者标的的竞买人管理中进行修改！
		</td>
	</tr>
</table>
</form>
</div>
</body>
</html>

<script>
//打開竞买人修改窗口
function openUpdateApply(bailCtrl,applyId,realName,phone,email,status,allowBuyNum,factBail){
	var obj=new Object();
	obj.applyId=applyId;
	obj.realName=realName;
	obj.phone=phone;
	obj.email=email;
	obj.status=status;
	//obj.allowBuyNum=strUtil.doNull(allowBuyNum,"");
	//obj.factBail=strUtil.doNull(factBail,"");
	
	$("#updateApply_window").dialog('open');
	var updateApplyFormName = "updateApplyForm";
	clearFormById(updateApplyFormName);
	loadData(obj,updateApplyFormName);//给表单赋值
}

//保存修改竞买人信息
function saveUpdateApply(){
	var infoId = $("#updateApplyForm").find("input[name='applyId']").val();
	if(!strUtil.isNull(infoId)){
		editSubmit('apply',infoId,'updateApplyForm');		
	}else{
		alert("applyId不存在");
	}
}


//更新后回调方法
function editCallBack(flag,objName){
	if(flag=="T"){
		  alert("保存竞买人信息成功！");
		  clearFormById('updateApplyForm');
		  $("#updateApply_window").dialog('close');
		  	applyListSearch();
		}
}

function viewCache(userName,itemId,sessionId){
	var ourl = ctx+spaceDomain + objName + "/compareApply?userName="+userName+"&itemId="+itemId+"&sessionId="+sessionId;
	$("#new-window-url").attr('src',ourl);
	$("#new-window").dialog({title:"比较竞买人的数据库和缓存内容"});
	$("#new-window").dialog('open');
}

//查询提交
function applyListSearch(){
    var status =$("#applyItemStatus").val();
    if("finish"==status){
       objName="applyHistory";
    }else{
       objName="apply";
    }
	searchSubmit(objName,"applyList");
}
function applyWayText(t){
	if(t==0)return "网上报名";
	else return "现场报名";
}
//初始化加载
$(function(){
	//加载分页列表
	applyListSearch();
});

</script>

